#ifndef PWAVE_STENCILMATH_H
#define PWAVE_STENCILMATH_H

#include "swt_env_win_linux.h"
#include "lct_env_macros.h"


#ifdef USE_SW_ATHREAD

#ifdef __cplusplus
extern "C" {
#endif
void slave_stencil_order_4_kern_athread(double *dst, const double *src, const double *coeffc2_dist,
                                        int start_x, int start_y, int start_z,
                                        int end_x, int end_y, int end_z, int ldx, int ldy);

#ifdef __cplusplus
}
#endif


#ifdef __cplusplus
extern "C" {
#endif
void slave_stencil_order_4_pml_kern_athread(double *dst, const double *src, const double *coeffc2_dist, const double *c2dtQ_dist,
                                            int start_x, int start_y, int start_z,
                                            int end_x, int end_y, int end_z, int ldx, int ldy);
#ifdef __cplusplus
}
#endif


#elif defined(USE_SW_ACC)

#ifdef __cplusplus
extern "C" {
#endif
void stencil_order_4_kern_acc(double *dst, const double *src, const double *coeffc2_dist,
                              int start_x, int start_y, int start_z,
                              int end_x, int end_y, int end_z, int ldx, int ldy);

#ifdef __cplusplus
}
#endif


#ifdef __cplusplus
extern "C" {
#endif
void stencil_order_4_pml_kern_acc(double *dst, const double *src, const double *coeffc2_dist, const double *c2dtQ_dist,
                                  int start_x, int start_y, int start_z,
                                  int end_x, int end_y, int end_z, int ldx, int ldy);

#ifdef __cplusplus
}
#endif


#endif // USE_SW_ATHREAD, USE_SW_ACC


class StencilMath {
public:
    // dest = u(t - dt) = u(t + dt), src = u(t)
    static void stencil_order_4_kern(double* dst, const double* src, const double* coeffc2_dist,
                                     int start_x, int start_y, int start_z,
                                     int end_x, int end_y, int end_z, int ldx, int ldy);

    static void stencil_order_4_pml_kern(double* dst, const double* src, const double* coeffc2_dist, const double* c2dtQ_dist,
                                         int start_x, int start_y, int start_z,
                                         int end_x, int end_y, int end_z, int ldx, int ldy);

    static double Ricker(double f, double t, double t0);
};

#endif //PWAVE_STENCILMATH_H
